<?php
class Core_Controller_Plugin_AclCheck extends Zend_Controller_Plugin_Abstract {
	public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request) {
		
		$resource = 'page.' . strtolower ( $request->getControllerName () );
		$role = Zend_Registry::get ( 'Core_User' )->getRole ();
		$acl = Zend_Registry::get ( 'Zend_Acl' );
		
		try {
			if (! $acl->isAllowed ( $role, $resource ))
				Zend_Controller_Action_HelperBroker::getStaticHelper ( 'redirector' )->gotoSimple ( 'index', 'index' );
		
		} catch ( Exception $e ) {
		}
	
	}
}